method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
48dae354-de86-4a19-b4c6-3fc4e710b46b | 8 | protected void createDOMElement() {
Document doc = BLXUtility.createDOMDocument();
if(this.getObjectType() == this.OBJECT_TYPE)
domElement = doc.createElementNS("blx", BLX_NS+":"+this.BLX_OBJ_NODE_NAME);
else
domElement = doc.createElementNS("blx", BLX_NS+":"+this.BLX_C... |
132badf2-32e3-46fb-a64d-d3feac7ed780 | 2 | protected void addConnection(int x, int y, boolean input, String name)
{
for (Component c : getComponents())
if (c.getName().equals(name)) throw new InvalidParameterException("Connection already exists with name: " + name);
Connection c = new Connection(name, input);
c.setBounds(x * Logicator.gridSize, y *... |
94374ad6-80f4-4c30-9340-cec80670e3ac | 8 | private List<Arg> getArgs(String[] args) {
List<Arg> argumentList = new ArrayList<Arg>();
if (args.length == 0 || args[0].charAt(0) != '-') {
argumentList.add(Arg.CODE_GENERATOR);
return argumentList;
} else {
for (String parameterizedArg : args) {
if (parameterizedArg.charAt(0) == '-') {
boolea... |
68ff1d9d-1049-4e8e-b37e-00cc4200a9ec | 5 | private JSONObject getResponseFromCookie(HttpServletRequest request) {
Map<String, String> previousIdps = new HashMap<String, String>();
String last = "";
Cookie[] cookies = request.getCookies();
if (cookies != null) {
for (Cookie cookie : cookies) {
String na... |
41a0b9fb-70ac-4013-b025-8937d407c25c | 1 | public void ARPStorm(byte[] targetIP) { // Generates a storm of poison ARPs
boolean kill = true; // A kill control variable
while (kill == true) { // While kill is true
ARPPacket p = this.ARPGen(targetIP);
// Generate a new ARP packet targeted at the targetIP parameter
inject.inject(p); // Injects the pois... |
2d33ff1a-36bf-4271-a3c6-48da3ed79413 | 6 | protected int countDifferences(Vector<Boolean> oldValue, Vector<Boolean> newValue) {
if (oldValue.equals(newValue)) {
return 0;
}
if (oldValue.size() <= newValue.size()) {
int result = 0;
for (int i = 0; i < oldValue.size(); i++) {
if (oldValue... |
7f59b1ab-b1bf-4444-930a-0e34cc01985d | 9 | private boolean step() throws LexicalError, SyntaticError, SemanticError
{
if (currentToken == null)
{
int pos = 0;
if (previousToken != null)
pos = previousToken.getPosition()+previousToken.getLexeme().length();
currentToken = new Token(DOLLAR, "... |
8ba43955-597a-49e1-b7ad-80768b05023a | 0 | public String toString() {
return super.toString();
} |
fa50288c-f147-45b7-a195-933b4204c71c | 4 | public void toTwoD(){
double[] hold0 = (double[])this.point.clone();
double[] hold1 = new double[2];
boolean test1 = true;
for(int i=2; i<this.nDimensions; i++){
if(hold0[i]!=0.0)test1 = false;
}
if(test1){
for(int i=0; i<2; i++)hold1[i] = hold0[i]... |
fa5b5d07-ef32-4800-b5cc-338a6ff912c0 | 2 | public static SaleType build(String saleTypeStr) {
switch(saleTypeStr) {
case("分销"):
return DISTRIBUTION;
case("承销"):
return UNDERWRITTING;
}
throw new IllegalArgumentException("错误的销售方式字符串{" + saleTypeStr + "}");
} |
ca90be96-feda-4b54-92ba-8b3a636cf6ff | 3 | private boolean isaNonFoodItem(Material item){
Material i = item;
if(i == Material.WATER_BUCKET || i == Material.BOWL || i == Material.POTION){
return true;
}else{
return false;
}
} |
3106abc9-4c8b-4cb2-8ace-a997e25f4f55 | 1 | public Stats mutateClone() {
HashMapStats myClone = new HashMapStats();
for (Stat stat : stats.values()) {
myClone.put(new Stat(stat.getType(), stat.getValue() * Random.getGaussian(0.5, 1.5)));
}
return myClone;
} |
a10052de-6b73-467a-861d-eedae9a651fe | 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... |
1cc345a5-ccf3-40f3-963f-e49a833e7ebd | 2 | @Override
public void caseAExplist(AExplist node)
{
inAExplist(node);
if(node.getExp() != null)
{
node.getExp().apply(this);
}
{
List<PExprest> copy = new ArrayList<PExprest>(node.getExprest());
for(PExprest e : copy)
{
... |
fbf70e5f-9e2c-4137-8569-48b6d6958f68 | 1 | private double calcMLon () {
double add = 0;
for (int i = 0; i < nbrPoints; i++) {
add = add + positions.get(i).getLongitude();
}
double result = add / nbrPoints;
return (result);
} |
cd16a260-a360-4bb5-8452-68e6ea0c26b4 | 6 | public Configuration start(String[] args) {
try {
// Load and validate properties
System.out.println(" -- Loading and validating configuration");
Configuration config = loadAndValidateProperties();
if (config.inputDir == null || config.inputDir.trim().length() == 0) {
System.out.println(" -- No co... |
1c93b91d-dad1-47da-ae69-1c990e660e40 | 7 | @SuppressWarnings("deprecation")
@EventHandler
public void onEntityRegainHealth(EntityRegainHealthEvent event) {
if (enabled) {
if (event.getEntity() instanceof Player) {
if (victims.containsValue(((Player) event.getEntity()).getName())) {
for (String name : victims.keySet()) {
Player attacker = B... |
a1076dcd-94aa-44d0-9b28-39d9b67d5b9b | 2 | public PdfDocument addAbsolutePosition(PdfElement element) {
try {
if (!element.setPosition(pdfwriter.getDirectContent(), document
.getPageSize().getWidth(), document.getPageSize()
.getHeight())) {
document.add(element.getPdfElement());
... |
995f2dd4-d3c9-4615-93e4-baa54c1165e3 | 3 | @SuppressWarnings("unchecked")
private static void loader() {
try {
for(String name : typeNames)
types.add(
(Class<? extends Pet>)Class.forName(name));
} catch(ClassNotFoundException e) {
throw new RuntimeException(e);
}
} |
14efa211-6e19-4514-814e-573558c6b801 | 2 | public boolean isCarrying() {
Layered layered = gob().getattr(Layered.class);
if (layered != null) {
return layered.containsLayerName("gfx/borka/body/standing/arm/banzai/") ||
layered.containsLayerName("gfx/borka/body/walking/arm/banzai/");
}
return false;
} |
6ab96f50-f44f-4c6d-8f19-ac21472206c6 | 5 | public void keyboard() {
String defualt_key = config.getKeyBinding();
log.logDebug("The defualt keyboard key is: " + defualt_key);
KeyBindingManager bindingmanager = SpoutManager.getKeyBindingManager();
bindingmanager.registerBinding("Start vote!", keyboard_translate.Translate(defualt_key), "Starts a new ... |
ad81929f-d067-4f84-ab02-1ccdf770b1d2 | 8 | public static void main(String[] args) {
//1.)
System.out.println("1.)\n");
OrderedSet<Description> s = new OrderedSet<Description>();
Description d1 = new Description("abcdefg\nhijklmnop\nqrstuvw\nxyz");
Description d2 = new Description("111111111\n222222");
Description d3 = new Description("ABC\n123\n9... |
70ff106d-1549-4cad-a036-8c7e6e341a65 | 3 | public Rectangle getVisibleBoundaries( Graphics g ){
Rectangle result = null;
for( GraphPaintable paintable : paintables ){
Rectangle boundaries = paintable.getVisibleBoundaries( g );
result = union( result, boundaries );
}
for( Component child : canvas.getComponents() ){
Rectangle boundaries = c... |
a45e2e75-4715-4ca9-92e4-40461a41947c | 4 | public int climbStairs(int n) {
if (n ==0 || n == 1 || n == 2){
return n;
}
else{
int result = 0;
int First = 1, Second = 2;
for (int i = 2; i < n; i++){
result = First + Second;
First = Second;
Secon... |
608e5e19-2d93-41b2-973b-dec99462a0ec | 5 | public void updateAction() {
if(actionList.hasAction() || currentAction != null) {
if(currentAction == null) {
currentAction = actionList.poolCurrentAction();
currentAction.setStartTime(System.nanoTime());
} else {
if(currentAction.isOver()) {
currentAction.endAction();
currentAction = nul... |
c5b78baa-7833-4769-8358-b8444ee02ac7 | 1 | public CategoryDAO CategoryDAO(){
if (categoryDAO == null){
categoryDAO = new CategoryDAOImpl();
}
return categoryDAO;
} |
3ceb37cd-ee91-416b-893f-5613ac770024 | 5 | public boolean isSyncMark(int headerstring, int syncmode, int word)
{
boolean sync = false;
if (syncmode == INITIAL_SYNC)
{
//sync = ((headerstring & 0xFFF00000) == 0xFFF00000);
sync = ((headerstring & 0xFFE00000) == 0xFFE00000); // SZD: MPEG 2.5
}
else
{
sync = ((headerstring & 0xFFF80C00) ==... |
64f767b6-912c-4b88-9797-053130b308c3 | 2 | public Torrent getMode(String str) {
if (str.equals("single"))
return Torrent.SINGLE;
else if (str.equals("multi"))
return Torrent.MULTI;
else
return Torrent.UNKNOWN;
} |
a4e53a3b-6869-4e03-835c-13cd62ae06aa | 5 | public static void merge(double[] input, int lo, int mid, int hi) {
// Must use auxilliary array. In-place merge is a lot harder. See book.
double[] aux = new double[hi - lo];
// Merge into aux
int i = lo;
int j = mid;
for (int m = 0; m < aux.length; m++) {
if (i >= mid) {
aux[m] = input[j++];
... |
5c3886c4-cb77-4d31-a4b4-86fb0ea2059e | 0 | @Test
public void storeAndRetrieve() {
final String expected = "stored object";
cache.put(cacheKey, expected);
String actual = cache.get(cacheKey, String.class);
assertSame(expected, actual);
} |
25db89b0-4301-4b2d-9190-6c208203e5c1 | 4 | private void write(SelectionKey key) throws IOException {
try{
SocketChannel socketChannel = (SocketChannel) key.channel();
synchronized (this.pendingData) {
List<ByteBuffer> queue = (List<ByteBuffer>) this.pendingData.get(socketChannel);
// Write until there's not more data ...
while (!queue.isEmp... |
4c87fc07-a560-445e-bb04-8bc7705f4040 | 0 | public PeerID(byte[] data, int tries) {
this.data = data;
this.tries = tries;
} |
808ef7b2-8b47-4748-808f-62b76782f4cb | 8 | protected org.apache.axis.client.Call createCall() throws java.rmi.RemoteException {
try {
org.apache.axis.client.Call _call = super._createCall();
if (super.maintainSessionSet) {
_call.setMaintainSession(super.maintainSession);
}
if (super.cachedU... |
49ab215e-55d1-4103-aaad-d32827a17322 | 8 | public void testCanHaveImprovement() {
for (TileType tileType : spec().getTileTypeList()) {
if (tileType.isWater()) {
if (highSeas.equals(tileType)) {
assertFalse(tileType.canHaveImprovement(fishBonusLand));
assertFalse(tileType.canHaveImprove... |
7861ab30-a89b-4817-95c4-8f33ceb0e873 | 0 | public TrayIcon getTrayIcon() {
return trayIcon;
} |
b125822d-ea68-4ad5-a08d-966579dd7583 | 8 | private void smoothingFilter(int rad) {
int size = 2*rad+1;
float [] k = getBlurKernel(2*rad+1);
for (int y=0; y < height; y++) {
for (int x=0; x < width; x++) {
int i = y*width + x;
if (plotList[i] != null) {
float sum = 0;
float n = 0;
for (int dy = -rad, ky = 0; dy<=rad; ... |
9fd47106-d843-4a8b-9d2e-0d4dfdc6b6c7 | 1 | @Override
public int rowsY() {
return isNotPlayerInventory() ? 1 : 2;
} |
5b9f8c8e-f551-4288-acec-c1d0456776b8 | 4 | private double internalReadDouble(int code) throws IOException {
switch (code) {
case Codes.DOUBLE:
return is.readRawDouble();
case Codes.DOUBLE_0:
return 0.0D;
case Codes.DOUBLE_1:
return 1.0D;
default: {
... |
9daf4511-a78a-495d-bb06-e9e87962c002 | 9 | public short deinitialize()
{
short ret = MsgDumperCmnDef.MSG_DUMPER_SUCCESS;
if (t.isAlive())
{
try
{
// If the user does NOT notify the thread to die, notify it before waiting for its death
if (!exit.get())
{
ret = notify_to_deinitialize();
if (MsgDumperCmnDef.CheckMsgDumperFailure(ret)... |
c56522d2-75d4-4dfe-aa86-6c0587e27fad | 9 | public static void main(String[] args) throws IOException{
InputStream entradaSistema = System.in;
InputStreamReader leitor = new InputStreamReader(entradaSistema);
BufferedReader leitorEntrada = new BufferedReader(leitor);
String entradaTeclado;
char menuOpcao;
char opca... |
583b7277-6899-4e82-8dd8-463a8ca19ee7 | 5 | private void benchmark() {
stage.hide();
secondaryStage = new Stage(StageStyle.UTILITY);
secondaryStage.setTitle("Benchmarking...");
StackPane sp = new StackPane();
benchmarkBar = new ProgressBar();
benchmarkBar.setPrefWidth(400);
benchmarkBar.setPrefHeight(30);
... |
666c60d5-58f1-44c7-b74c-0eccd9f47dea | 8 | public static boolean batch( WebSocketImpl ws, ByteChannel sockchannel ) throws IOException {
ByteBuffer buffer = ws.outQueue.peek();
WrappedByteChannel c = null;
if( buffer == null ) {
if( sockchannel instanceof WrappedByteChannel ) {
c = (WrappedByteChannel) sockchannel;
if( c.isNeedWrite() ) {
... |
bdb6f86b-56dd-4b0d-a40d-4f4aa3395ebc | 2 | private void sqrtActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sqrtActionPerformed
if (!"".equals(text.getText())) {
double value = Double.parseDouble(text.getText());
value = Math.sqrt(value);
if (value >= 0) {
printer(value);
... |
e6a7f231-99ae-4ad9-8470-5401c6ae4aae | 7 | private static void setDestination(IControl control)throws Exception{
//coordinates of parking slot
double back_X = destination.getBackBoundaryPosition().getX();
double back_Y = destination.getBackBoundaryPosition().getY();
double front_X = destination.getFrontBoundaryPosition().getX();
double front_Y = ... |
778f71fa-3dfd-4e82-9c2d-4a0bd3fa6038 | 1 | protected void printProgression(int n){
System.out.println(firstValue());
for(int i=2;i<=n;i++){
System.out.println(nextValue());
}
} |
33cbf1be-62a8-4653-8687-0d4cd3bec09f | 2 | public boolean contains(String nickname) {
for (User user : model) {
if ( user.getNickname().equalsIgnoreCase(nickname) )
return true;
}
return false;
} |
6e8faf19-8f2e-46e8-a2c7-ac66061f4213 | 3 | public static void writeAllSentences(List<List<String>> sentences,
String outputFilePath) throws IOException {
File output = new File(outputFilePath);
if (!output.exists()) {
output.createNewFile();
}
BufferedWriter bw = new BufferedWriter(new FileWriter(output));
StringBuilder builder = new StringBuild... |
2dd53921-2da1-4715-a9ae-a5ce2d22a606 | 3 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Author)) return false;
Author author = (Author) o;
if (!name.equals(author.name)) return false;
return true;
} |
634fd904-3a8f-4f8f-ace6-c2e18270eb9a | 1 | public int getModifiers() {
if ((status & HIERARCHY) == 0)
loadInfo(HIERARCHY);
return modifiers;
} |
201a34b1-a181-4b60-a60c-1e15077ebb65 | 2 | private CoreConstants() {
properties = new Properties();
LOG.info("The properties file is being loaded: " + APP_PROPERTIES);
try (FileInputStream inputStream = new FileInputStream(APP_PROPERTIES)) {
properties.load(inputStream);
LOG.info("Properties file load successful");
} catch (FileNotFoundException e... |
fa53c878-f477-4db3-a0f9-d3ee2c203661 | 3 | @Override
public void run() {
// TODO Auto-generated method stub
CImedWrapper wrapper = new CImedWrapper(this.getProxy(), this.getUsername(), this.getPwd());
boolean bServiceAvailable = false;
boolean bReportingAvailable = false;
try{
bServiceAvailable = wrapper.CheckServiceAvailable();
... |
65b45b7d-b014-41c0-b688-f89eeb0e5d30 | 3 | @Override
public A set(A a, B b) {
try {
setMethod.invoke(a, b);
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
return a;
} |
d5c44041-fe6e-4d91-888c-58d10412b888 | 8 | public boolean setInputFormat(Instances instanceInfo) throws Exception {
if ((instanceInfo.classIndex() > 0) && (!getFillWithMissing())) {
throw new IllegalArgumentException("TimeSeriesTranslate: Need to fill in missing values " +
"using appropriate option when class ... |
9ee1028a-7121-45c4-a22c-86572aabbee3 | 9 | void bondAminoHydrogen(int indexDonor, Point3f hydrogenPoint,
BitSet bsA, BitSet bsB) {
AminoMonomer source = (AminoMonomer)monomers[indexDonor];
Point3f sourceAlphaPoint = source.getLeadAtomPoint();
Point3f sourceNitrogenPoint = source.getNitrogenAtomPoint();
int energyMin1 = 0... |
57c7ae25-0ceb-45d2-a7ea-a4b66542ee0e | 4 | private static void insertObs(Difficulty diff, Point enter, Orientation orientation){
Random random = new Random();
int recAccuracy = GetConfigByDiff.setRecAccuracy(diff);
float x, y, h, l;
x = y = h = l = 0;
switch (orientation){
case left: {
l = recA... |
af48a7e3-dd59-44d2-a0d0-530ed14172b1 | 5 | @Override
public int getCount(E data) {
// We traverse the list until the node with data as its value is found, then return its count
// If no such node is found we return 0
if(head == null){
// Empty list has no node with data as its value
return 0;
}
// Does head match? If so, return its count
List... |
68489845-e6ed-4865-b779-24fa7b968d4d | 2 | static LookAndFeel getFactory(CHOICE choice) {
LookAndFeel lookAndFeel = null;
switch (choice) {
case WINDOWS:
lookAndFeel = new WindowsLookAndFeel();
break;
case MOTIF:
lookAndFeel = new MotifLookAndFeel();
break;
... |
9886e08f-1f59-4f09-be74-c92aea5a12e2 | 9 | private void expand(SyrianGraph g, SimpleHeuristicNode hn,
AbstractList<SimpleHeuristicNode> toBeExpanded,
AbstractList<SimpleHeuristicNode> alreadyExpanded) {
this.setExpansions(this.getExpansions() + 1);
// trivial expansion
AbstractCollection<SyrianEdge> edges = g.getAllEdgesForVertex(hn
.getRoot());... |
054f2e67-ddc5-487e-8ddf-0190da45296e | 8 | void setPendingViewOffset(int xofs,int yofs) {
if (!pf_wrapx) {
if (xofs < 0) xofs=0;
if (xofs > tilex*(nrtilesx-viewnrtilesx))
xofs = tilex*(nrtilesx-viewnrtilesx);
}
if (!pf_wrapy) {
if (yofs < 0) yofs=0;
if (yofs > tiley*(nrtilesy-viewnrtilesy))
yofs = tiley*(nrtilesy-viewnrtilesy);
}
p... |
3d9258c2-3bdd-4306-a483-43804bddbf8e | 4 | public static String decrypt(String cipher)
{
if(firstTime) {initTabel();firstTime = false;}
cipher = cipher.toUpperCase();
char[] crypt = cipher.toCharArray();
String tmp="";
String plain = "";
int x,y,pos = 0;
for(int i=0;i<crypt.length;i+=2)
{
//luam doua cate doua
tmp = crypt[i]+""+crypt[i... |
72c48846-8476-470a-87c7-be671c61ac3b | 6 | public void addRock(int x, int y, int size) {
if ((size <= 3) && (size > 0)) {
for (int i = 0; i < size; i++) {
for (int j = 0; j < size; j++) {
if ((y+j<this.ourMap.length) && (x+i<this.ourMap[j].length)) {
this.ourMap[y+j][x+i] = new Tile(2);
}
}
}
}
} |
3ec5b7c2-b06d-4bd0-88f6-f84809922cc0 | 1 | public static String getFix() {
char c = automata.turing.Tape.BLANK;
StringBuffer b = new StringBuffer();
for (int i = 0; i < 20; i++)
b.append(c);
return b.toString();
} |
3aa11f50-b941-4621-b0e4-6a7faa67ed3f | 8 | public void paintComponent(Graphics gx) {
super.paintComponent(gx);
if (m_plotInstances != null
&& m_plotInstances.numInstances() > 0
&& m_plotInstances.numAttributes() > 0) {
if (m_plotCompanion != null) {
m_plotCompanion.prePlot(gx);
}
m_JRand = new Random(m_JitterVal);
paintAxis(... |
7358dbc9-ea4b-4faf-91be-6432124fb72e | 0 | public void setItemId(int itemId) {
this.itemId = itemId;
} |
f5f33043-d99f-43cf-b8ec-fef9a9f9c714 | 4 | public void methodExplorer(File folder) {
methods = new MethodVisitor();
for (File file : folder.listFiles()) {
if (file.isDirectory()) {
methodExplorer(file);
} else {
if (file.getName().endsWith(".java")) {
String fileName = file.getName().substring(0,
file.getName().length() - 5);
... |
b8a9b347-c8d7-4e4e-9511-807de9cef5c4 | 3 | private static void fillBuffer() { // Wait for user to type a line and press return,
try {
buffer = in.readLine();
}
catch (Exception e) {
if (readingStandardInput)
throw new IllegalArgumentException("Error while reading standard input???");
else if (inputFile... |
3b8209fd-f372-474e-aad2-434858ceec73 | 1 | @Override
public void destroy() {
if(currentSector > -1) {
Application.get().getLogic().getGame().getSector(currentSector).releaseLocation(owner);
}
} |
b9c047fe-0bd4-44c3-b03a-839e968da924 | 4 | public void handleInput()
{
int in = input.getInput();
if(in == Keys.W){this.velocity.thisAdd(new Vector2D(0,-8));}
if(in == Keys.S){this.velocity.thisAdd(new Vector2D(0,8));}
if(in == Keys.A){this.velocity.thisAdd(new Vector2D(-8,0));}
if(in == Keys.D){this.velocity... |
1523a7dd-cb3e-4056-9b7f-56d5351085a4 | 8 | private List<Gate> getIncrementedGates(List<Gate> parsedGates){
List<Gate> res = new ArrayList<Gate>();
int incNumber = largestAugOutputWire + 1 - numberOfOriginalInputs;
for (Gate g: parsedGates) {
if(!g.isXOR()){
g.setGateNumber(g.getGateNumber() + numberOfNonXORGatesAdded);
}
//If left wire is y... |
22dc57c2-c483-4869-aff7-4364f2d073fa | 8 | protected List <Segment> installedBetween(Tile start, Tile end) {
final List <Segment> installed = super.installedBetween(start, end) ;
if (installed == null || installed.size() < 4) return installed ;
//
// If the stretch to install is long enough, we cut out the middle two
// segments and instal... |
7cffc302-e5a2-46ee-b4d1-6bcbf33ede83 | 5 | public ConstOperator deobfuscateString(ConstOperator op) {
ClassAnalyzer clazz = methodAnalyzer.getClassAnalyzer();
MethodAnalyzer ma = clazz.getMethod(methodName, methodType);
if (ma == null)
return null;
Environment env = new Environment("L"
+ methodAnalyzer.getClazz().getName().replace('.', '/') + ";"... |
674d869c-f019-4db1-8437-1ee3a92a019c | 1 | @Override
public int down() throws ParsingException
{
if (!canStepDown)
{
throw new InvalidParseCommandException("Can't step down. Element " + currentElement.getName()
+ " does not have any unparsed child elements", lastEvent.getLocation().getLineNumber(), lastEvent
.getLocation().getColumnNumber());... |
81addf9e-1253-42c2-8f54-95ac623503ed | 3 | @Override
public boolean addClient(Client client) {
int shortestLineIndex = 0;
int shortestLineTime = Integer.MAX_VALUE;
for(int i = 0; i < cashiers; i++){
int currentLineTime = 0;
for(int j = 0; j < lines[i].size(); j++){
currentLineTime += lines[i].get(j).getExpectedServiceTime();
}
if(currentL... |
f12383f0-cb56-417e-a0bf-654dfb8d487d | 1 | @Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
try {
processRequest(request, response);
} catch (Exception ex) {
Logger.getLogger(ControlJson.class
.getName()).l... |
c955291a-e9e6-41ee-8145-6c965bf0f11d | 8 | public void move(Direction theD){
if(theD == null) {
return;
}
switch(theD) {
case UP:
this.y--;
facingDirection = Direction.UP;
break;
case DOWN:
this.y++;
facingDirection = Direction.DOWN;
break... |
51368b75-f344-4b40-be20-8c86b1f9284d | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
UtilisateurVue other = (UtilisateurVue) obj;
if (nom == null) {
if (other.nom != null)
return false;
} else if (!nom.equals(other.nom))
... |
67d0c56b-977f-49e2-ae04-69227a969e1d | 4 | private void assertEquals(String text, Object expected, Object result) {
boolean equal;
// tests equality between expected and result accounting for null
if (expected == null) {
equal = result == null;
} else {
equal = result != null && expected.equals(result);
}
if (!equal) {
// prints the descrip... |
0f238eb7-7e7f-42cf-a92b-348ff9973537 | 8 | public void addToGroup(Group g, Piece p)
{
if (p == null || g.pieces.contains(p) || (g.pieces.size() > 0 && g.pieces.toArray(new Piece[0])[0].team != p.team))
{
return;
}
int row = p.where.row;
int col = p.where.col;
g.pieces.add(p);
if (col > 0)
{
addToGroup(g, squares[row][col - 1].piece);
... |
10ab8fca-c6ce-43f7-9efa-045b5d5628b5 | 5 | public
Analyser(StringBuilder builder, Logger log)
{
this.log = log;
this.code = builder.toString();
if(log_level >= 3) log.log(3, key, "Analyser is doing stuff please wait ...", "\n");
types = new TYPES(log);
program_stack ... |
174f57fd-63b4-4d5e-9c26-03ce562b1870 | 3 | public double resolveCollisionX(AABB other, double moveAmtX) {
double newAmtX = moveAmtX;
if (moveAmtX == 0.0) {
return moveAmtX;
}
if (moveAmtX > 0) {
// Our max == their min
newAmtX = other.getMinX() - maxX;
} else {
// Our min == their max
newAmtX = other.getMaxX() - minX;
}
if (Math.ab... |
61818047-f72d-4ebe-b80f-fade6acf678d | 7 | public void sort(SortArray points, SortCanvas c) {
int max = 6; // too dangerous to take more
int i;
// remove the unused points from view
for( i = max + 1; i < points.length(); i++)
points.put(i, -100);
c.clearWindow();
Random rand = new Random(new Random().nextInt());
for (i = 1; i <= ... |
a559bbd0-439e-43b4-b750-d206cc84ad47 | 8 | protected void buildIndexMap(RootDoc root) {
PackageDoc[] packages = root.specifiedPackages();
ClassDoc[] classes = root.classes();
if (!classesOnly) {
if (packages.length == 0) {
Set<PackageDoc> set = new HashSet<PackageDoc>();
PackageDoc pd;
... |
c4800c3c-df96-400e-acd7-a7b8da77700f | 8 | @Override
public void addEdge(Edge edge) {
// check to see if it is a valid edge
if (!edge.validGameEdge()) {
throw new IllegalArgumentException("Invalid edge inserted. Edges must have both of their endpoints defined.");
}
... |
19d40785-d157-46a7-9b0b-c1e952a5ae48 | 8 | private boolean cellaValida(Cella cella){ // contolla se la cella cliccata è una mossa valida
mangiate = new MangiateValide();
if (mangiate.trovaMangiateBianche(damiera).isEmpty()) { // cerca tra i movimenti
MosseValide mosse = new MosseValide(damiera, mossaUtente[0].getx(), mossaUtente[0].gety(),... |
7756e240-ebf9-48ff-ac39-543a185f81d9 | 0 | @Override
public void setMobile(String mobile) {
super.setMobile(mobile);
} |
1296ed74-f41a-4b08-9a8a-65bc43cac68d | 6 | public KeyNodeIntPair dealWithPromote(int newKey, Node rightChild,
InternalNodeInt node) {
// if new key is greater than the key in the last element of list
// insert child into the node
if (newKey > node.getKeys().get(node.size() - 1)) {
node.getKeys().add(newKey);
node.getChildren().add(rightChild);
... |
ec8af9cb-0b5e-42ad-af34-ab0710572666 | 7 | protected TNorm extractTNorm(String line) {
List<String> token = Op.split(line, ":");
if (token.size() != 2) {
throw new RuntimeException("[syntax error] "
+ "expected property of type (key : value) in line: " + line);
}
String name = token.get(1).trim();
... |
1b7d85c2-8eb7-4868-8851-cc7c5fbfe21e | 9 | public static String normalizeNewlines(String input) {
String result = input;
if (input != null) {
char[] chars = input.toCharArray();
final int length = chars.length;
int startWritePos = 0;
StringBuffer resultBuffer = null;
char previousChar = 0;
for (int index = 0; index < length; index++) {
... |
4911c0b8-1152-4e37-aeab-e43c8d33d82d | 9 | private ArrayList<Integer> generateAgeColumnCodes(ArrayList<String> columnLabels) {
ArrayList<Integer> columnCodes = new ArrayList<Integer>();
for(int i = 0; i < columnLabels.size(); i++) {
String curLabel = columnLabels.get(i);
if(curLabel.equals(Constants.APTA_AGE_0_14_LBL))
columnCodes.add(i, Const... |
f874696c-9441-484f-a6e2-0e7722014a14 | 0 | public CommandCwlookup(CreeperWarningMain plugin) {
this.plugin = plugin;
} |
c7c39a76-f820-4825-8063-25bc8184757e | 0 | public void setNomFichier( String nomFichier ) {
this.nomFichier = nomFichier;
} |
a66ecd45-390f-4124-b7c7-871dbd836341 | 8 | static void validateSymbolName(final GenericDescriptor descriptor)
throws DescriptorValidationException {
final String name = descriptor.getName();
if (name.length() == 0) {
throw new DescriptorValidationException(descriptor, "Missing name.");
} else {
... |
fa09d252-716c-4df8-b15e-88687579f7b7 | 1 | public boolean estEnCours(){
if(this.etat == EN_COURS){
return true ;
}
else {
return false ;
}
} |
a503daa6-87d9-4d74-9e5a-ebf0383571e1 | 5 | public static void main(String[] args) {
String fileName;
if (args.length > 0) {
fileName = args[0];
} else {
fileName = "jenkinslamps.properties";
}
try {
LampConfig config = LampConfigReader.read(new FileInputStream(new File(fileName)));
... |
60684e2d-5204-47cb-aea6-73f6f3f656ed | 3 | public void loseALife(boolean passed, boolean boss){
if (passed == true){
if (!boss){
lives--;
}
else{
lives -= 10;
}
}
if (lives <= 0){
lives = 0;
}
} |
f6441da8-816e-4114-b459-25f9b4721332 | 4 | public static Drilling nextDrillFor(Actor actor) {
if (actor.base() == null) return null ;
if (! (actor.mind.work() instanceof Venue)) return null ;
final World world = actor.world() ;
final Batch <DrillYard> yards = new Batch <DrillYard> () ;
world.presences.sampleFromKey(actor, world, 5, yard... |
1565c1bb-6377-4101-9d2d-be1ae72b7797 | 2 | @Override
public void collideWith(Element e) {
if (isActive()) {
if (e instanceof Player) {
collideWithPlayer((Player) e);
getGrid().removeElement(this);
}
}
} |
911d744c-a59e-4684-8d1a-be408af1f149 | 3 | public void setReaders(BytePacket[] value)
{
for(BytePacket packet : value)
{
if(readers.get(packet.type) != null)
try
{
throw new Exception("try to override reader in DataReader");
} catch (Exception e)
{
e.printStackTrace();
}
log.debug("add reader " + packet.type);
reader... |
a947c24c-190b-4213-8609-87bc57c7f208 | 0 | public String getType() {
return type;
} |
01ecc3f2-fa8f-43e2-a186-55e56f40fe02 | 5 | public static void main(String[] args)
{
Graph G = null;
try
{
G = new Graph(new In(args[0]));
}
catch (Exception e)
{
System.out.println(e);
System.exit(1);
}
int s = Integer.parseInt(args[1]);
IPaths paths = new Paths(G, s);
for (int v = 0; v < G.V(); v++)
{
System.out.print(s + "... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.