method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
aae573d5-7ca1-40f8-890e-df3451f1ed58 | 2 | public void drawState(Graphics g, State state) {
if (selected.contains(state)) {
getStateDrawer().drawState(g, getAutomaton(), state,
state.getPoint(), SELECTED_COLOR);
if (doesDrawStateLabels())
getStateDrawer().drawStateLabel(g, state, state.getPoint(),
StateDrawer.STATE_COLOR);
} else
sup... |
7727f821-8f25-44ed-a041-d72130770da8 | 7 | private void func_48430_a(File par1File, File par2File, WorldChunkManager par3WorldChunkManager, int par4, int par5, IProgressUpdate par6IProgressUpdate)
{
try
{
String var7 = par2File.getName();
RegionFile var8 = new RegionFile(par2File);
RegionFile var9 = new Re... |
277254e3-e322-48a2-a5c1-967e84736b3e | 9 | public static void pprintDescriptionsAsRule(Description head, Description tail, Proposition rule, org.powerloom.PrintableStringWriter stream) {
{ Vector headvariables = null;
Vector tailvariables = null;
boolean forwardruleP = ((BooleanWrapper)(KeyValueList.dynamicSlotValue(rule.dynamicSlots, Ontosaurus... |
61597301-66af-4ec7-a688-7088715f157a | 8 | public static void recoverTree(TreeNode root) {
List<TreeNode> nodes = new ArrayList<TreeNode>();
traversal(root, nodes);
for (TreeNode tn : nodes) {System.out.print(tn.val + " ");}
int i = 0;
int index1 = -1;
int index2 = -1;
for (i = 0; i < nodes.size() - 1; i++... |
ea614fd9-32d0-48a2-8981-3aa54c2fbc17 | 0 | public static String convertToUnix(String text) {
// Convert \r\n -> \n
text = Replace.replace(text,"\r\n","\n");
// Convert \r -> \n
text = Replace.replace(text,"\r","\n");
return text;
} |
e333d188-76cd-4c2a-9e21-9e2f27f50d9b | 8 | public void paintContent(Graphics2D g) {
int w = getWidth();
int h = getHeight();
g.setColor(Color.LIGHT_GRAY);
g.fillRect(0, 0, w, h);
g.setColor(Color.BLACK);
int xFactor = 5;
int yFactor = 3;
g.setColor(Color.BLACK);
backWall = new Rectangl... |
120495f4-2c03-4896-80ec-5004286f8bdb | 8 | public static boolean isEmpty(Automaton a) {
if (a.getNumStates() == 0) {
// Common case: no states
return true;
}
if (a.isAccept(0) == false && a.getNumTransitions(0) == 0) {
// Common case: just one initial state
return true;
}
if (a.isAccept(0) == true) {
// Apparent... |
f69b1015-ad41-450a-a690-758f739629cd | 1 | public XMLReaderSAX getSAXReader() {
if (saxReader == null) {
saxReader = new XMLReaderSAX();
}
return saxReader;
} |
e4ad471a-3ce2-40f5-bab7-05358c01c779 | 2 | public void ordinaryChar(int ch) {
if (ch >= 0 && ch < ctype.length)
ctype[ch] = 0;
} |
636af4aa-852a-4177-bc0e-55f05970fd09 | 4 | public List<Position> getPositionsAround(Position position) {
if (position == null)
throw new IllegalArgumentException("Position can't be null!");
Set<Position> positions = new HashSet<Position>();
if (validPosition(position))
positions.add(position);
for (Movement move : Movement.values()) {
Positio... |
80710566-cdf9-40df-b93c-fe3d927bb234 | 5 | public static String getCurrentTime() {
Calendar c = Calendar.getInstance();
String result = "";
int temp;
result += c.get( Calendar.YEAR ) + "_";
if( ( temp = c.get( Calendar.MONTH ) + 1 ) < 10 ) {
result += "0";
}
result += temp + "_";
if( ( temp = c.get( Calendar.DAY_OF_MONTH ) ) < 10 ) {
... |
3dc6c81c-63b8-4d8e-b939-6ded4a4c00d4 | 3 | @SuppressWarnings("deprecation")
@Override
public void run() {
for (int i = 0; i <= 1; i++) {
if (!data.isEmpty()) {
int index = r.nextInt(data.size());
RegenData rd;
synchronized (lock) {
rd = data.remove(index);
}
Block b = rd.getW().getBlockAt(rd.getX(), rd.getY(), rd.getZ());
in... |
d1de997b-b533-428f-ad00-8c37c6589bd6 | 8 | public static int Boruvka(Graph input) {
input.setState(States.ARR_ADJ);
Log.print(Log.system, "Boruvka algorithm:");
// init:
int N = input.getVertexCount();
int M = input.getEdgeCount();
int[][] arr_inc = new int[N][M];
int[][] arr_adj = new int[N][N];
@SuppressWarnings("unchecked")
ArrayList<ListN... |
da7992e9-6682-475f-afe1-957b7737f0f9 | 1 | public void setIsLocalRunMode(Boolean localRunMode) {
if (this.isLocalRunMode != localRunMode) {
this.isLocalRunMode = localRunMode;
NotifyRunModeChanged(localRunMode);
}
} |
ff719cf6-da9a-4b4c-8a41-97f0fe30c298 | 2 | private void preTraversal(TreeNode node,StringBuilder sb){
if(sb.length()>0) sb.append(",");
if(node==null) sb.append("NULL");
else{
sb.append(node.val);
preTraversal(node.left, sb);
preTraversal(node.right, sb);
}
} |
232d6f1d-c165-4f32-adbb-d2aa2b5d3c27 | 3 | /* */ public synchronized void update(long elapsedTime) {
/* 29 */ if (this.frames.size() > 1) {
/* 30 */ this.animTime += elapsedTime;
/* 31 */ if (this.animTime >= this.totalDuration) {
/* 32 */ this.animTime %= this.totalDuration;
/* 33 */ this.currentFrame = 0;
/* */ }
... |
c40fb9d9-a878-432e-809f-52d34800f4b3 | 1 | public boolean isEmpty() {
return mChildren[0] == null && mChildren[1] == null;
} |
803809fd-61fd-4440-a973-4b2aceff1d73 | 7 | public void deathAni()
{
switch (aniNum)
{
case 0:
sprt = imgD1.getImage();
if(Game.tickCount2 == game.DELAY){
aniNum = 1;
}
break;
case 1:
sprt = imgD2.getImage();
if(Game.tickCount2 == game.DELAY){
aniNum = 2;
}
break;
case 2:
sprt = imgD5.getImage();
if... |
527b0415-2e45-4633-97ec-cda686eb4e3b | 4 | public static void setFieldValue(Object object,
String fieldName,
String value){
try {
Field field = object.getClass().getDeclaredField(fieldName);
field.setAccessible(true);
if(field.getType().equals... |
c502587c-0803-4753-89a3-4bdd267ae413 | 5 | @Override
public IEvent emit(IEvent event) {
Iterator<Map<Class<? extends IEvent>, List<IEventListener>>> itr = this.mapListeners.values().iterator();
while (itr.hasNext()) {
Map<Class<? extends IEvent>, List<IEventListener>> mapListener = itr.next();
List<IEventListener> listeners = mapListener.get(event.ge... |
352e57c9-aef9-410a-9db4-792845305521 | 0 | public Window(Game game) {
// Game instance
this.game = game;
// Game and board
this.setTitle("Chess");
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setLayout(new BorderLayout());
this.setResizable(true);
this.setIconImage(this.iconImage.getImage());
this.pack();
// Create menu... |
8ff043f2-95a2-4ccb-bb79-b9a0b3dbd2b2 | 3 | private void initMouse() {
try {
if (!jTextField1.getText().equals("")) {
listVarInt.put("nbSourisG", Integer.parseInt(jTextField1.getText()));
} else {
listVarInt.put("nbSourisG", 0);
}
if (!jTextField2.getText().equals("")) {
... |
d194a432-c2a0-4bc4-b006-a7c5aa415ba6 | 6 | public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof LabelValue)) {
return false;
}
LabelValue bean = (LabelValue) obj;
int nil = (this.getValue() == null) ? 1 : 0;
nil += (bean.getValue() == null) ? ... |
bd48058d-0d46-40ea-b01b-bcb82206320a | 7 | void radf2(final int ido, final int l1, final double in[], final int in_off, final double out[], final int out_off, final int offset) {
int i, ic, idx0, idx1, idx2, idx3, idx4;
double t1i, t1r, w1r, w1i;
int iw1;
iw1 = offset;
idx0 = l1 * ido;
idx1 = 2 * ido;
for ... |
8f3c0a4b-b9d1-4697-8b95-b79c271601f9 | 8 | public static void demarrer(){
String choixJeu;
resterDansLeCasino = true;
System.out.println("\n\nBienvenue dans le Casino !");
while (resterDansLeCasino)
{
if (joueur.age < 21)
{
System.out.println ("Vous êtes trop jeune... |
54f64ba3-d1ae-4d24-936d-f5f45121d2de | 1 | private void buildPostOrderTraversal(GeneralTreeNode<T> cur) {
Iterator<GeneralTreeNode<T>> it = cur.getChildren();
while (it.hasNext()) {
this.buildPostOrderTraversal(it.next());
}
OutputQueue.add(cur);
} |
7644b680-792f-4733-adc7-b29e5af35660 | 0 | public DisconnectOnServerEvent(Object server, ISocketServerConnection clientConnection) {
super(server);
this.clientConnection = clientConnection;
} |
8391ad57-e98d-4cf6-aba8-1f92104e6be5 | 6 | public void setDay(int d) {
if (d < 1) {
d = 1;
}
Calendar tmpCalendar = (Calendar) calendar.clone();
tmpCalendar.set(Calendar.DAY_OF_MONTH, 1);
tmpCalendar.add(Calendar.MONTH, 1);
tmpCalendar.add(Calendar.DATE, -1);
int maxDaysInMonth = tmpCalendar.... |
6b56d583-9fe7-48dd-8211-eca1a1304c8b | 2 | public static int readVersion(Handshakedata handshakedata) {
String vers = handshakedata.getFieldValue("Sec-WebSocket-Version");
if (vers.length() > 0) {
int v;
try {
v = new Integer(vers.trim());
return v;
} catch (NumberFormatException e) {
return -1;
}
}
return -1;
} |
8b154b18-c51b-4a05-be3f-d03e09e6b5fd | 9 | private void read24Bit(byte[] bdata) {
// Padding bytes at the end of each scanline
int padding = 0;
// width * bitsPerPixel should be divisible by 32
int bitsPerScanline = width * 24;
if ( bitsPerScanline%32 != 0) {
padding = (bitsPerScanline/32 + 1)*32 - bitsPerScanline;
padding = (int)Math.ceil(paddi... |
b8a33bc0-13c9-47c0-a110-ac301302ba6b | 0 | public void method1() {
adaptee.method2();
} |
dac31ca9-3349-423a-8928-0da9665a9919 | 0 | public static void main(String[] args)
{
enumCompareTo(opConstant.SHOOT);
} |
29663091-10f9-4e29-bf40-0af5aba88d3a | 0 | @Override
public void setName(String name) {
this.name = name;
} |
3d00600d-1a30-423c-8f06-dc19b6b449e1 | 8 | public static int escapeXmlChar(Writer out, char ch, int buffIndex, char[] buff, int buffLength) throws IOException {
int nextIndex;
if (ch < 0xA0) {
// If "?" or over, no escaping is needed (this covers
// most of the Latin alphabet)
if (ch >= 0x3f) {
... |
946e841d-855b-4073-a547-b24f70d42dba | 3 | public ServerData( String name, String shortName, boolean force, String channel, int localDistance, boolean connectionMessages ) {
this.serverName = name;
this.shortName = shortName;
this.forceChannel = force;
if ( channel.equalsIgnoreCase( "server" ) ) {
this.forcedChannel =... |
bedfddf4-96b3-4f5a-a5fb-5316222fe431 | 7 | public void changeLoc(int newLocX, int newLocY) {
if (PRIVS != PRIVS.BANNED || (BATTLE == null && !BLN_SLEEP && Game.canMoveTo(newLocX,newLocY,this))) {
if (isMob()) {
if (!(Math.abs(originalX-newLocX) < Game.VIEW_RANGE && Math.abs(originalY-newLocY) < Game.VIEW_RANGE)) {
return;
}
}
changeLocB... |
827a4c89-bdbb-4470-ad8f-d087ccc3eae2 | 5 | @Override
public void configure(AbstractCommand command, String[] args) {
TimeBanBanCommand banCommand = (TimeBanBanCommand) command;
List<String> players = CommandLineParser.getListOfString(args[0]);
String reason = stdBanReason;
Calendar until = UntilStringParser.parse(stdBanDurat... |
47edbe52-45a4-4d40-9a85-2846e8bf1118 | 2 | public void testProperty() {
MonthDay test = new MonthDay(6, 6);
assertEquals(test.monthOfYear(), test.property(DateTimeFieldType.monthOfYear()));
assertEquals(test.dayOfMonth(), test.property(DateTimeFieldType.dayOfMonth()));
try {
test.property(DateTimeFieldType.millisOfDay... |
a6194c2d-ac18-44f9-ad9a-3a2947d1acf1 | 2 | private static boolean isLychrel(int n){
BigInteger temp = new BigInteger(Integer.toString(n));
for(int i=0;i<50;i++){
String reverse = new StringBuilder(temp.toString()).reverse().toString();
temp = temp.add(new BigInteger(reverse));
if (isPalindrome(temp.toString())) return false;
}
return true;
} |
d71ec83e-6e1b-4619-8179-5b57bea4de68 | 3 | public boolean processMsg(CConnection cc) {
OutStream os = cc.getOutStream();
StringBuffer username = new StringBuffer();
// JW: Launcher passes in username as property of Options object,
// so there's no need to pop up a dialog asking for a username
// if it is already recorded within the Options... |
b089fc72-f773-424f-ade9-8b46854bc80b | 7 | private void monitorTouchInput()
{
boolean isPressed = touch.isPressed();
while (!Thread.interrupted())
{
if (touch.isPressed() && !isPressed)
{
isPressed = true;
for (TouchListener l : listeners)
{
l.contactInitiated();
}
}
else if (!touch.isPressed() && isPressed)
{
isPr... |
6b3d9b42-9196-4e9c-8073-c8cb27815c4f | 2 | private boolean hasWildCard(RedisBigTableKey key)
{
boolean hasWildCard = Utils.hasWildCard(key.getRow());
hasWildCard = hasWildCard && Utils.hasWildCard(key.getColumnFamily());
hasWildCard = hasWildCard && Utils.hasWildCard(key.getColumnQualifier());
return hasWildCard;
} |
ee4ad95b-3ead-43e6-a569-49c6c7c012c4 | 3 | private boolean matchSpaces(String sentence, int matches) {
int c = 0;
for (int i = 0; i < sentence.length(); i++) {
if (sentence.charAt(i) == ' ')
c++;
if (c == matches)
return true;
}
return false;
} |
3b852ff6-376c-4a58-9e07-5ed245dd5234 | 5 | private void loadStats() throws IOException {
String line;
boolean fileFound = true;
int nameScoreDate = 0; ///< Names = 0, Scores = 1, Dates = 2
int j; ///< Line in leaderboard
try {
bfr = new BufferedReader(new FileReader(statsFile));
} catch (FileNotFoundE... |
f7c709cb-18e0-4ce4-9618-072cf6bc045f | 4 | @Override
public int compareTo(RushPlayer o) {
int killsA = kills;
int killsB = o.getKills();
if(killsA == killsB) {
int deathsA = deaths;
int deathsB = o.getDeaths();
if(deathsA == deathsB)
return 0;
else if(deathsA > deathsB)
return -1;
else
return 1;
}
else if(killsA > killsB)
... |
2819a9cd-06eb-4a64-925d-5a50c0b6649a | 0 | public String getClientIP()
{
return clientIP;
} |
d10fbb1a-e286-4119-8596-e229d8615a77 | 5 | public static void equalizeChannel(Image original, Image image,
ChannelType color) {
int[] ocurrences = getColorOccurrences(original, color);
int totalPixels = image.getWidth() * image.getHeight();
double[] levels = new double[totalPixels];
double s_min = 0;
double s_max = Image.MAX_VAL;
for (int i = 0; ... |
84054797-3dcb-4ca0-8518-ea9bb4e4a3ba | 5 | public int sum(TreeNode root, int top)
{
if (root == null) return top;
if (root.left == null && root.right == null)
{
return top * 10 + root.val;
}
int sum = 0;
if (root.left != null) sum += sum(root.left, top * 10 + root.val);
if (root.right != null) sum += sum(root.right, top * 10 + root.... |
fee87788-d743-4e13-8ef3-6fb26fb22617 | 9 | public static void main(String[] args) {
int port = defaultPort;
String host = defaultHost;
// Auf Eingabeparameter ueberpruefen und gegebenenfalls setzten.
if (args.length > 0) {
for (int i = 0; i < args.length; i++) {
// Pruefen, ob ein Parameter den Port angibt.
if ((args[i] = ... |
37560399-649f-4345-9d69-cd36c6787ea4 | 9 | public TwoWarriorsVsTwoHobgoblins() {
model = new CPModel();
// Tableau de variable représentant les dommages reçus par le premier
// guerrier
for (int i = 0; i < NB_OF_ROUNDS; i++) {
warrior1DamageReceived[i] = makeIntVar(
"warrior 1 damage received for round" + (i + 1),
HOBGOBLIN_DMG);
model.... |
c88970cc-c7f5-4291-a49c-d989f90461fd | 0 | @Override
public String toString() {
return "ARGS " + new Integer(numberOfArguments).toString();
} |
2e65bd33-2169-4fc3-845e-e79f480a5284 | 3 | public static void removeConnection(InetSocketAddress sockaddr) {
if(!isInit) { init(); }
for(int i = 0; i < clientRecent.size(); i++) {
if(clientRecent.get(i).equals(sockaddr)) {
clientRecent.remove(i);
}
}
} |
542a7ab5-96f9-478d-8a8e-ec90fd85b029 | 7 | private void runGame(Player p1, Player p2, Sign s1, Sign s2)
{
if (s1 == s2)
{
draw(p1, p2, s1);
return;
}
if ((s1 == Sign.ROCK && s2 == Sign.SCISSORS)
|| (s1 == Sign.SCISSORS && s2 == Sign.PAPER)
|| (s1 == Sign.PAPER && s2 == Sign.ROCK))
finishGame(p1, p2, s1, s2);
else
finishGame(p2, p1... |
8302a061-8766-4486-85f7-86cbc083a09e | 4 | public static void removeCopy(int copyId){
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try{
conn.setAutoCommit(false);
PreparedState... |
750fc1e0-166d-4202-a780-83454392f20b | 0 | public synchronized void stop() {
running = false;
} |
8de51385-1c3c-481c-a491-9e4cc01d2db3 | 0 | public Requests() {
} |
55b09076-a0b2-4083-9033-df096139476b | 1 | private int parseInt(String value) throws InvalidFormatException {
try {
return Integer.parseInt(value);
} catch (NumberFormatException e) {
throw new InvalidFormatException();
}
} |
95b62452-2e36-4d64-ab62-0ef624df7a8b | 1 | @Override
public IEmailKontakt first() throws NoEmailKontaktFoundException {
EmailKontaktList emailContacts = readContacts();
if (emailContacts.getContactList().size() == 0) {
throw new NoEmailKontaktFoundException("Kein Kontakt gefunden!");
} else
return emailContacts.getContactList().get(0);
} |
e79b1621-b157-4bb3-bd9a-a48fabeee845 | 3 | public boolean check(String userName, String password) {
for (Account account : accountList) {
if (account.getUserName().equals(userName)
&& account.getPassword().equals(password)) {
return true;
}
}
return false;
} |
462489e5-f1c9-473d-9db6-c70e83e9c0aa | 5 | public BefehlsPanel()
{
setLayout(null);
setSize(682, 512);
_labelFuerLebensenergie = new JLabel();
_labelFuerLebensenergie.setLocation(ABSTAND_NORMAL, 0);
_labelFuerLebensenergie.setSize(50, BefehlsPanel.this.getHeight() - 50);
_beinstellenButton = new JButton(BEINSTELLEN);
_beinstellenButton.setSize(... |
82a0986b-49ac-4505-9164-90470cf993ea | 5 | public void run() {
while (true) {
try {
Socket socket = mServerSocket.accept(); // Wait for a new peer
Log.i("PeerAccepter", "New Peer connected ->");
MessageInputStream mis = new MessageInputStream(socket.getInputStream());
Handshake handshake = mis.readHandShake();
Hash infoHash = ... |
9fefcfc7-cc8c-4526-af13-3208f3ff0435 | 0 | @Column(name = "percent")
@Id
public double getPercent() {
return percent;
} |
87b49d22-64f7-4afe-be47-4ea7a28866b5 | 4 | protected static byte[] decodeData(String password, BufferedImage origin, BufferedImage otp) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, UnsupportedEncodingException {
byte[] otpA = null;
if (otp != null) {
otp... |
bb047f31-2595-46c3-8550-376c89fd86f1 | 6 | public static RuleSet GenerateRuleSets(TransactionSet transSet, TransactionSet finalLargeItemSet,double minConfidenceLevel) {
Timer timer = new Timer();
timer.startTimer();
RuleSet allRuleSets = new RuleSet(new ArrayList<Rule>());
for (Transaction itemset : finalLargeItemSet.getTransactionSet()) {
Arr... |
61d3e86f-34a9-48a0-bac9-d74d766a9fb5 | 4 | public final void setNoOfLeds(final int NO_OF_LEDS) {
int amount = NO_OF_LEDS < 5 ? 5 : NO_OF_LEDS;
if (amount > noOfLeds.get()) {
for (int i = 0 ; i < (amount - noOfLeds.get()) ; i++) {
ledColors.get().add(Color.RED);
}
}
if (null == noOfLeds) {
... |
499e4929-50dc-4f98-b2d7-d10e22a33c78 | 5 | public String toString()
{
StringBuffer sb = new StringBuffer();
sb.append( versions+": " );
if ( parent != null )
{
sb.append("["+parent.id+":");
sb.append( new String(parent.data) );
sb.append( "]" );
}
else if ( children != null )
{
sb.append("{"+id+":");
sb.append( new String(data) );
... |
d3a09de6-fa74-4319-ab5d-f70c8387ba75 | 5 | public static byte[] decrypt(byte[] data, byte[] key) {
if(data.length == 0) {
return data;
}
int[] s = Util.bytesToInts(data);
int[] g = Util.bytesToInts(Arrays.copyOfRange(key, 0, 16));
int d = s.length;
int j = s[d - 1], l = s[0];
int o = 0x9E377... |
e52298a9-a7d6-48af-9d3f-ecca5514bf69 | 8 | public GUI() {
setBackground(Color.DARK_GRAY);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(10, 10, 745, 485);
contentPane = new JPanel();
contentPane.setForeground(Color.DARK_GRAY);
contentPane.setBackground(Color.DARK_GRAY);
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPa... |
03d166c6-df33-46a4-8992-5122ed64e8a9 | 2 | private int compareMastRecWithTransRec(AcctsRecMastRec m,
AcctsRecTransRec t, Comparator<String> comp) {
int result;
if (t == null) {
result = -1;
} else if (m == null) {
result = 1;
} else {
result = comp.compare(m.getKey(), t.getMastKey());
}
return result;
} |
e35cbec4-1c08-4afb-93fe-466fd9a0118c | 8 | @Override
@SuppressWarnings({ "nls", "boxing" })
protected void initialize(Class<?> type, Object oldInstance,
Object newInstance, Encoder enc) {
super.initialize(type, oldInstance, newInstance, enc);
if (type != oldInstance.getClass()) {
return;
}
Choice choice = (Choice) oldInstance;
int count = ... |
c66e2682-5903-4a78-abbf-6ca43eb52b1c | 8 | @Override
public Area areaLocation(CMObject E)
{
if(E==null)
return null;
if(E instanceof Area)
return (Area)E;
else
if(E instanceof Room)
return ((Room)E).getArea();
else
if(E instanceof MOB)
return areaLocation(((MOB)E).location());
else
if(E instanceof Item)
return areaLocation(((Ite... |
eea24c8a-44d0-47af-9a2e-41f26b2ce37a | 0 | @Test(expected = RuntimeException.class)
public void twoInchesPlusEightOuncesShouldThrowException(){
ArithmeticQuantity two_in = new ArithmeticQuantity(2, Distance.INCHES);
ArithmeticQuantity eight_oz = new ArithmeticQuantity(8, Volume.OUNCE);
two_in.add(eight_oz);
} |
7306c3d7-7425-4a6d-b0c2-b3867d7c5ed9 | 9 | public void simplify()
{
top:for(Element elem1 : array)
{
for(Element elem2 : array)
{
if(elem1 != elem2 && elem1.getClass().getName().equals("PowerSupply") == false && elem2.getClass().getName().equals("PowerSupply") == false)
{
if(elem1.getConnections("first").indexOf(elem2) !=... |
1f6356b3-6cda-42a6-966b-57c3ffe88033 | 6 | Sequence (String url_1, String url_2, String url_3) {
if (url_1 == null || url_2 == null || url_3 == null
|| url_1.isEmpty() || url_2.isEmpty() || url_3.isEmpty()) {
throw new IllegalArgumentException("Neither of the construction urls allowed to be null or empty");
... |
d6f23f3d-e4f7-4dbc-830b-40f0a26c6859 | 8 | private boolean addDeklinationSubstTable( String wikiText, int fromIndex, String baseWord ) {
Properties props = BookUtils.parseRule( wikiText, "Deutsch Substantiv bersicht", fromIndex );
if( props != null ) {
if( props.remove( "Bild" ) != null || props.remove( "Bild 1" ) != null ) {
... |
e8967823-5168-4a5c-b2b0-46ac8ee7dfe4 | 4 | public Instantiation findOwner(final int i) {
if (!subroutine.ownsInstruction(i)) {
return null;
}
if (!dualCitizens.get(i)) {
return this;
}
Instantiation own = this;
for (Instantiation p = previous; p != null; p = p.previous) {
if (p.subroutine.ownsInstruction(i)) {
own = p;
}
... |
d78feaf2-cc9c-4d3c-a289-44a248407ec0 | 1 | public t(int nu) throws ParameterException {
if (nu < 1) {
throw new ParameterException("t parameter nu >= 1");
} else {
this.nu = nu;
chiSq = new ChiSquared(nu);
norm = new Normal(0, 1);
}
} |
b26478c6-a375-4c42-9982-518ade469238 | 2 | protected void loadNBT(NBTTagCompound data) {
NBTTagList list = data.getTagList("pairings", 10);
for (byte entry = 0; entry < list.tagCount(); entry++) {
NBTTagCompound tag = list.getCompoundTagAt(entry);
int[] c = tag.getIntArray("coords");
pairings.add(new WorldCoor... |
9f9e4ae7-f303-4059-b6fb-343e259ac49e | 4 | @Override
public void update(GameContainer container, int delta) throws SlickException {
i = container.getInput();
if (i.isKeyDown(Input.KEY_UP)) {
gc.key_up(delta);
} else if (i.isKeyDown(Input.KEY_DOWN)) {
gc.key_down(delta);
}
if (i.isKeyDown(Input.KEY_RIGHT)) {
gc.key_righ... |
07eccb24-00f1-4721-9738-2ed0e05c0551 | 1 | public Key min()
{
if (minIndex != -1)
return pq[minIndex];
return null;
} |
edf96530-88f1-462b-8912-acf1cf8f52b2 | 0 | public void setPayment(boolean payment) {
this.payment = payment;
} |
d2f2a8ce-c1f4-423f-8b0a-1e24f81daf94 | 6 | private static String loadPattern(String fileName) {
BufferedReader in;
StringBuilder b;
if (fileName == null) {
return null;
} // if
try {
in = new BufferedReader(new InputStreamReader(new FileInputStream(fileName), Charset.forName(chars... |
b58b7a1a-fce9-466b-a54e-def8698718b5 | 3 | @Override
public final void registerId(final Path parent, final String filename) {
final Path p = parent == null ? Path.getPath(filename) : parent.resolve(filename);
final int pathId = Deserializer_0.this.pathIdNextOut.incrementAndGet();
final byte[] idBytesPrev = writeIntRE(parent == null ? 0 : Deserialize... |
0a0345d0-dccb-44d9-870f-87dec6043348 | 3 | public final void callAttachments(Interface sender, String message) {
ArrayList<Interface> receiver = new ArrayList<Interface>();
// Find all receiver in attachments list
Iterator<Attachment> itAttach = this.attachments.iterator();
while(itAttach.hasNext()) {
Interface dest = itAttach.next().getReceiver(... |
4a83fa4a-f3bc-418a-8e96-94e9370f7499 | 7 | @Override
public List<Race> raceQualifies(int theme)
{
final Vector<Race> qualRaces = new Vector<Race>();
final HashSet<String> doneRaces=new HashSet<String>();
for(final Enumeration<Race> r=CMClass.races();r.hasMoreElements();)
{
Race R=r.nextElement();
if(doneRaces.contains(R.ID()))
continue;
R... |
faf383eb-6cc0-4c26-ab38-964ff1ccb58a | 9 | public void handleDoMPIMaster(MutationManager mutMan, int size) throws MPIException, InterruptedException {
//KER: If it isn't an mpiRun start extra threads so that we can simulate
//an mpiRun
if(!mpiRun)
MPItoThread.startThreads(this,Thread.currentThread());
CommucObj cObjArray[] = new CommucObj[size]... |
6a1acb39-b0d1-4d65-a771-ffb172502fc5 | 3 | private static boolean isHexNumber(String value) {
int index = (value.startsWith("-") ? 1 : 0);
return (value.startsWith("0x", index) || value.startsWith("0X", index) || value
.startsWith("#", index));
} |
d26545be-2344-4c34-b2e3-611dcd3433dd | 1 | public static void main(String args[])
{
// null check
Utility.printObject(null);
DataBase db = new DataBase();
// null fields
Utility.printObject(db);
Name n = new Name();
Utility.printObject(n);
n.firstName = "Aviva";
n.lastName = "Herman";
// prints a real object
Utility.pri... |
2a307e72-0b5e-43a1-92f2-a02338f52651 | 8 | protected static Ptg calcPRICEMAT( Ptg[] operands )
{
if( operands.length < 4 )
{ // not supported by function
return new PtgErr( PtgErr.ERROR_NULL );
}
debugOperands( operands, "calcPRICEMAT" );
try
{
GregorianCalendar sDate = (GregorianCalendar) DateConverter.getCalendarFromNumber( operands[0].get... |
2323bee5-b8ad-40dc-b6bd-a5aa74705bd9 | 2 | public boolean ParseChatCommand(Session mSession, String Command)
{
String CommandName = SplitCommand(Command, true)[0];
if (!ChatCommands.containsKey((CommandName).toLowerCase()))
{
mSession.SendAlert(CommandName + " isn't a valid chat command!", null);
return false;
}
if (mSession.GrabHabbo().R... |
d9113a2c-c427-4f45-a105-50a40715b48f | 6 | public void rotate(Direction dir)
{
if (dir == Direction.EAST)
{
Log.i("Rotating model right");
for (Level l : levels)
{
for (Piece p : l.pieces)
{
int oldY = p.y;
p.y = p.x;
p.x = getHeight()*2 - oldY- 1; // height pre swap
p.type = Pi... |
1e62f055-b302-4a53-bff7-f66d4e247e97 | 8 | public static void printInfo() {
Logger.logInfo("FTBLaunch starting up (version " + Constants.version + " Build: " + Constants.buildNumber + ")");
Logger.logInfo("Java version: " + System.getProperty("java.version"));
Logger.logInfo("Java vendor: " + System.getProperty("java.vendor"));
L... |
9b57e151-4ea5-4da6-91e1-05e736da8d38 | 6 | private boolean ReadConfigFile()
{
//read status
boolean status = false;
//holds each line read
String data = null;
//hold the name of the section of the config file
String section = null;
try
{
//open the file input stream
... |
080db315-283a-4739-8b84-be3bab9ca2c6 | 6 | private static void setExtendedParentPointers (final int[] array) {
final int length = array.length;
array[0] += array[1];
for (int headNode = 0, tailNode = 1, topNode = 2; tailNode < (length - 1); tailNode++) {
int temp;
if ((topNode >= length) || (array[headNode] < array[topNode])) {
temp = array[h... |
e26700d8-e7e3-439b-b9b4-5b05e09024f5 | 5 | @Override
public Class<?> getColumnClass(int columnIndex) {
switch(columnIndex){
case 0:
return String.class;
case 1:
return Ingredient.class;
case 2:
// return String.class;
return Double.class;
case 3:
return Component.class;
// return Double.class;
// return String.class;
def... |
9d070b24-098c-4dc5-9a04-d8a0e18cc0f6 | 3 | private void bindAmountScrolled() {
int var1 = this.getContentHeight() - (this.bottom - this.top - 4);
if(var1 < 0) {
var1 /= 2;
}
if(this.amountScrolled < 0.0F) {
this.amountScrolled = 0.0F;
}
if(this.amountScrolled > (float)var1) {
this.amountScrolled =... |
440a114e-e9fc-4231-93ef-ac878f102653 | 8 | public static boolean buildInstance(String account, String name) {
//Clear progress (partially redundant)
GlobalDialogs.setProgressCaption("Initializing...");
GlobalDialogs.setProgressValue(0);
//Mark instance as incomplete
Logger.info("Instances.buildInstance",... |
4a2f24b4-7c7a-4e0f-b197-8578bfad04f5 | 0 | public void removeView(AbstractView view) {
registeredViews.remove(view);
view.removePropertyChangeListener(this);
} |
3cbf9a81-e603-46de-9f83-23c5ad7be41f | 3 | @Override
public int compareTo(Object e) {
if(this.weight > ((Edge)e).weight)
return 1;
if(this.weight < ((Edge)e).weight)
return -1;
if(this.weight == ((Edge)e).weight)
return 0;
return 0;
} |
a21f2b96-060a-4901-82c9-04f6d8b1f0b3 | 5 | public SchemaEditorToolBar(final BasicGraphEditor editor, int orientation)
{
super(orientation);
setBorder(BorderFactory.createCompoundBorder(BorderFactory
.createEmptyBorder(3, 3, 3, 3), getBorder()));
setFloatable(false);
add(editor.bind("New", new NewAction(),
"/com/mxgraph/examples/swing/images/ne... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.